package com.project.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("user")
public class UserController {

    @RequestMapping("checkName")
    public String checkName(String name){
        if("java".equals(name)){
            return "no";
        }
        return "ok";
    }

    @RequestMapping("find")
    public void find(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher("/test.html").forward(req,resp);
    }

    @RequestMapping("getNum")
    public String getNum(){
        return "2";
    }
}
